package com.hunan.yllxy.repostitory.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hunan.yllxy.repostitory.entity.Role;
import com.hunan.yllxy.repostitory.mapper.RoleMapper;
import com.hunan.yllxy.repostitory.dao.RoleDao;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hunan.yllxy.util.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 刘华
 * @since 2025-06-16
 */
@Service
public class RoleDaoImpl extends ServiceImpl<RoleMapper, Role> implements RoleDao {

    @Override
    public List<Role> findByIds(List<String> roleIds) {
        if (StringUtils.isNull(roleIds)){
            return null;
        }
        LambdaQueryWrapper<Role> wrapper = Wrappers.lambdaQuery(Role.class);
        wrapper.in(Role::getId, roleIds);
        return baseMapper.selectList(wrapper);
    }

}
